aed6918571a4f6f9bce2af87b104c613f6784671,zanata-war/src/main/java/org/zanata/service/impl/StatisticsServiceImpl.java,StatisticsServiceImpl,getStatistics,#String#String#boolean#boolean#String[]#,87
Before Change
// trans unit level stats
TranslationStatistics transUnitStats = new TranslationStatistics();
transUnitStats.setLocale( locId.getId() );
transUnitStats.setUnit(TranslationStatistics.StatUnit.MESSAGE);
// Stats might not return anything if nothing is translated
if( count == null )
{
transUnitStats.setTranslated( 0 );
transUnitStats.setUntranslated( iterationTotalMssgs );
transUnitStats.setNeedReview( 0 );
transUnitStats.setTotal( iterationTotalMssgs );
}
else
{
transUnitStats.setTranslated( count.get(ContentState.Approved) );
transUnitStats.setUntranslated(count.get(ContentState.New));
transUnitStats.setNeedReview(count.get(ContentState.NeedReview));
transUnitStats.setTotal( count.getTotal() );
}
iterationStats.addStats(transUnitStats);
// word level stats
if( includeWordStats )
{
TransUnitWords wordCount = wordIterationStats.get(locId.getId());
TranslationStatistics wordStats = new TranslationStatistics();
wordStats.setLocale( locId.getId() );
wordStats.setUnit(TranslationStatistics.StatUnit.WORD);
if( wordCount == null )
{
wordStats.setTranslated( 0 );
wordStats.setUntranslated( iterationTotalWords );
wordStats.setNeedReview( 0 );
wordStats.setTotal( iterationTotalWords );
}
else
{
wordStats.setTranslated( wordCount.get(ContentState.Approved) );
wordStats.setUntranslated( wordCount.get(ContentState.New) );
wordStats.setNeedReview( wordCount.get(ContentState.NeedReview) );
wordStats.setTotal( wordCount.getTotal() );
}
iterationStats.addStats(wordStats);
}
After Change
long iterationTotalMssgs = projectIterationDAO.getTotalCountForIteration(iteration.getId());
long iterationTotalWords = projectIterationDAO.getTotalWordCountForIteration(iteration.getId());
for (LocaleId locId : localeIds)
{
// word level stats
TransUnitWords wordCount = wordIterationStats.get(locId.getId());
TranslationStatistics wordStats;
if (wordCount == null)
{
wordCount = new TransUnitWords(0, 0, (int) iterationTotalWords);
}
wordStats = getWordsStats(wordCount, locId);
wordStats.setRemainingHours(getRemainingHours(wordCount.get(ContentState.NeedReview), wordCount.get(ContentState.New)));
iterationStats.addStats(wordStats);
// trans unit level stats
TransUnitCount count = transUnitIterationStats.get(locId.getId());
TranslationStatistics transUnitStats;
if (count == null)
{
count = new TransUnitCount(0, 0, (int) iterationTotalMssgs);
}
transUnitStats = getMessageStats(count, locId);
transUnitStats.setRemainingHours(getRemainingHours(wordCount.get(ContentState.NeedReview), wordCount.get(ContentState.New)));
iterationStats.addStats(transUnitStats);
}